﻿using System;
using System.Collections.Generic;
using System.Text;

namespace daSyntaxAnalyser.SyntaxTree
{
    using daBase.Objects;

    public class ObjectEnumCommonTypeElement : IdElement
    {
        private ConstExpressionElement value;

        public ConstExpressionElement Value { get { return value; } set { this.value = value; } }

        public ObjectEnumCommonTypeElement(TokenInfo Id, ConstExpressionElement Value, List<TokenInfo> Comments)
            : base(Id, Comments)
        {
            value = Value;
        }

        public override string ToString()
        {
            string result = base.ToString();
            if (value != null)
                result += string.Format(" = {0}", value);
            return result;
        }

        protected override IEnumerator<ISyntaxTreeElement> CreateEnumerator()
        {
            if (value != null)
                yield return value;
        }
    }
}
